<?php defined('SYSPATH') or die('No direct script access.');

class Date extends Kohana_Date {
    
    
    //TODO: implement multi languages 
    public static function nice_span($timestamp)
    {
        $hours = self::span($timestamp,null,'hours');
        
        if($hours < 1)
        {
            return self::fuzzy_span($timestamp);
        }
        elseif($hours < 24)
        {
           return $hours.' hours ago' ;
        }
        else
        {
            if(date("Y", $timestamp) == date("Y", time()))
            {
                return date("d F", $timestamp);
            }
            else
            {
                 return date("d F Y", $timestamp);
            }
        }
    }
}
